package com.arice.activity;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;

import android.app.Activity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;

public class HelpActivity extends Activity {
	private TextView tvHelpTxt;
	private InputStreamReader isr;
	private FileInputStream fis;
	private InputStream is;
	private BufferedReader br;
	private String line = "";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.acticity_help);
		tvHelpTxt = (TextView) findViewById(R.id.tvhelptxt);
		tvHelpTxt.setMovementMethod(ScrollingMovementMethod.getInstance());
//		String temp = "1\r\n2\r\n1\r\n2\r\n1\r\n2\r\n1\r\n10";
//		tvHelpTxt.setText(temp);
		
		try {
			is = getResources().openRawResource(R.raw.help);
			isr = new InputStreamReader(is, "gbk");
			br = new BufferedReader(isr);
			StringBuffer sb = new StringBuffer("");
			while ((line = br.readLine()) != null) {
				sb.append(line);
				sb.append("\r\n");
			}
			tvHelpTxt.setText(sb);
		} catch (UnsupportedEncodingException e1) {
			e1.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				br.close();
				isr.close();
				is.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}

	}
}
